package com.young.mylib.view.dialog;

import android.content.Context;
import android.content.DialogInterface;
import android.widget.TextView;

import androidx.appcompat.app.AlertDialog;

/**
 * Created by Young on 2019/6/3.
 */

public class MsgDialog {
    public static void alert_text(final Context context, String title, String msg, final DialogImpl callback) {
        final TextView et = new TextView(context);
        et.setText(msg);
        new AlertDialog.Builder(context).setTitle(title)
                .setView(et)
                .setPositiveButton("确定", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        callback.onOk();
                    }
                }).setNegativeButton("取消", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                callback.onCancel();
            }
        }).show();
    }
}

